<?php
//初始化时间

class aTime {
    public static $time;

    //当前时间
    public static function now($date=false) {
        if (!$date) {
            return self::$time;
        } else {
            return self::ftime(self::$time);
        }
    }

    //将时间戳转换为可读时间
    public static function ftime($unixtime="",$format="") {
		global $AD;
        if (!$unixtime) {
            $unixtime=self::$time;
        }

        return gmdate(($format ? $format : $AD['timefmt']),$unixtime);
    }

    //将字符串转换成时间戳
    public static function strtime($time) {
        return strtotime($time);
    }
}
aTime::$time = time();
global $AD;
if($AD['timearea'] > 0) {
    aTime::$time += $AD['timearea'] * 3600;
}
?>